<template>
  <div :class="{classArticle:true,[$store.getters.isDay?'day':'night']:true}">
    <Header></Header>
    <div class="container">
      <div class="classBox">
        <div class="class" v-for="(item, index) in classList" :key="index">
          <transition appear name="class" mode="in-out">
            <span @click="goClassDetail(item)">{{ item }}</span>
          </transition>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Header from "../../components/Header.vue";
export default {
  name: "class",
  data() {
    return {
      classList: [],
    };
  },
  components: {
    Header,
  },
  created() {
    this.$axios.get("/vueShow/class/getAll").then((res) => {
      res.data.forEach((item) => {
        this.classList.push(item.class_name);
      });
    });
  },
  methods: {
    goClassDetail(data) {
      this.$router.push(`/classDetail/${data}`);
    },
  },
};
</script>

<style scoped lang="scss">
.classArticle {
  width: 100%;
  height: 100vh;
  // background-color: #339999;
  transition:all 0.5s ease-in-out;
  .container {
    width: 90%;
    padding-top: 75px;
    margin: 0 auto;
    .classBox {
      width: 100%;
      display: flex;
      justify-content: left;
      align-items: center;
      flex-wrap: wrap;
      background-color: #fff;
      margin-top: 50px;
      padding:35px 0;
      border-radius: 20px;
      box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.4);
      // box-shadow: 0 0 15px skyblue;
      overflow: hidden;
      span {
        display: block;
        width: 87px;
        height: 30px;
        background-color: #539999;
        line-height: 30px;
        text-align: center;
        font-size: 15px;
        font-weight: 600;
        // float: left;
        box-shadow: 0 0 5px skyblue;
        color:#000;
        margin: 10px 10px;
        border-radius: 15px;
        animation: in_view 1s ease-in-out 0.5s;
        transition:all 0.4s ease-in-out;
      }
      span:hover {
        color: #fff;
        cursor: pointer;
      }
    }
  }
}

@keyframes in_view {
  0%,
  50%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-25deg);
  }
  75% {
    transform: rotate(25deg);
  }
}
.class-enter-active,
.class-leave-active {
  transition: all 0.7s 0.5s ease-out;
}

.class-enter,
.class-leave-to {
  opacity: 0;
  transform: translateX(-275px);
}
.class-enter-to,
.class-leave {
  opacity: 1;
  transform: translateX(0);
}
</style>